<!doctype html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>键盘事件</title>
	<style type="text/css">
		* {
			margin: 0;
			padding: 0;
			font-family: "微软雅黑";
		}

		fieldset {
			width: 300px;
			margin: 10px auto;
		}

		dl {
			clear: both;
		}

		dt,
		dd {
			display: inline-block;
			height: 35px;
			line-height: 35px;
			;
		}

		dt {
			width: 80px;
			text-align: right;
		}

		input[type="submit"] {
			width: 60px;
			text-align: center;
			line-height: 25px;
		}
	</style>
</head>

<body>
	<fieldset>
		<legend>会员登录</legend>
		<dl>
			<dt>用户名：</dt>
			<dd><input id="userName" type="text" /></dd>
		</dl>
		<dl>
			<dt>密码：</dt>
			<dd><input id="password" type="password" /></dd>
		</dl>
		<dl>
			<dt></dt>
			<dd><input type="submit" value="登 录" /> </dd>
		</dl>
		<span id="events"></span>
	</fieldset>
	<script src="js/jquery-1.12.4.js"></script>
	<script>
		$(document).ready(function(){
			$("[type=password]").keyup(function(){
				$("#events").append("输入完成！");
			}).keydown(function(){
				$("#events").append("按下了！");

			}).keypress(function(){
				$("#events").append("正在输入！");

			})
		})

		$(document).keydown(function(events){
			if(events.keyCode=="13"){
				alert("确定提交吗")
			}
		})
	</script>


</body>

</html>